/****************************************************************************
 * Copyright (C) 2013 Dj Skual
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 ****************************************************************************/
#ifndef DOWNLOADSAVEWINDOW_H_
#define DOWNLOADSAVEWINDOW_H_

#include "GetSaveListTask.hpp"
#include "WiiSaveBrowser.h"
#include "../../Manage/ManageButtons.hpp"
#include "../../Prompts/PathBrowser.h"

class DownloadSaveWindow : public GuiFrame, public sigslot::has_slots<>
{
public:
	DownloadSaveWindow(u64 Tid, std::string ID, GuiFrame * parentElement);
	virtual ~DownloadSaveWindow();
	
	sigslot::signal0<> End;
	sigslot::signal1<int> Result;
	
private:
	void OnConnectClick(ManageButtons * connect, int choice);
	void OnConnectTaskEnd(int result);
	void OnGetSaveListEnd(WiiSave_List * list, int result);
	void OnSaveBrowserClose(int choice);
	void OnPathClick(ManageButtons * path, int choice);
	void OnPathBrowserButtonClick(PathBrowser *menu, u8 filter, bool doneClicked, const std::string &Path);
	void OnDownloadTaskEnd(int result);
	void OnResult(int result);
	void OnResultClick(ManageButtons * result, int choice);
	
	u64 tid;
	std::string id;
	int selectedSave;
	std::string dlFilepath;
	std::string dlFilename;
	ManageButtons * connectButtons;
	ManageButtons * pathButtons;
	ManageButtons * resultButtons;
	WiiSave_List * saveList;
	WiiSaveBrowser * saveBrowser;
};

#endif
